home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWPart / FWPresen.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  8.8 KB  |  267 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWPresen.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWPRESEN_H
  11. #define FWPRESEN_H
  12.  
  13. #ifndef FWTCOLL_H
  14. #include "FWTColl.h"
  15. #endif
  16.  
  17. #ifndef FWPART_H
  18. #include "FWPart.h"
  19. #endif
  20.  
  21. // ----- OS Layer -----
  22.  
  23. #ifndef FWRECT_H
  24. #include "FWRect.h"
  25. #endif
  26.  
  27. // ----- Foundation Includes -----
  28.  
  29. #ifndef FWRUNTYP_H
  30. #include "FWRunTyp.h"
  31. #endif
  32.  
  33. #ifndef FWTCOLL_H
  34. #include "FWTColl.h"
  35. #endif
  36.  
  37. // ----- OpenDoc -----
  38.  
  39. #ifndef FWODTYPS_H
  40. #include "FWODTyps.h"
  41. #endif
  42.  
  43. //========================================================================================
  44. //    Forward Declarations
  45. //========================================================================================
  46.  
  47. class ODArbitrator;
  48. class ODShape;
  49. class ODPart;
  50. class ODFrame;
  51. class ODFacet;
  52. class ODFocusSet;
  53.  
  54. class FW_CSelection;
  55. class FW_CFrame;
  56. class FW_CViewAs;
  57.  
  58. //========================================================================================
  59. //    class FW_CPrivDisplayFrame
  60. //========================================================================================
  61.  
  62. class FW_CPrivDisplayFrame
  63. {
  64. public:
  65.     FW_CPrivDisplayFrame(Environment *ev, FW_CFrame* frame);
  66.     FW_CPrivDisplayFrame(Environment *ev, ODID frameID);
  67.     ~FW_CPrivDisplayFrame();
  68.     
  69.     void        Release(Environment *ev);
  70.     
  71.     ODID        fFrameID;
  72.     ODFrame*    fODFrame;
  73.     FW_CFrame*    fFrame;
  74. };
  75.  
  76. //========================================================================================
  77. //    class FW_CPresentation
  78. //========================================================================================
  79.  
  80. class FW_CPresentation
  81. {
  82. public:
  83.     friend class FW_CPresentationFrameIterator;
  84.     
  85. //----------------------------------------------------------------------------------------
  86. //    Constructors/Destructors
  87. //
  88. public:
  89.     FW_CPresentation(Environment *ev, 
  90.                     FW_CPart* thePart, 
  91.                     FW_CSelection* selection, 
  92.                     ODTypeToken presentationType,
  93.                     FW_ResourceID viewResourceID,
  94.                     FW_ResourceID rootViewResourceID);
  95.     virtual ~FW_CPresentation();
  96.  
  97. //----------------------------------------------------------------------------------------
  98. //    New API
  99. //
  100. public:
  101.     // ----- Invalidate/Validate -----
  102.     void                Invalidate(Environment *ev, ODShape* invalidShape = NULL, ODID sequenceNumber = 0);
  103.     void                Validate(Environment *ev, ODShape* validShape = NULL, ODID sequenceNumber = 0);
  104.         
  105.     void                Invalidate(Environment* ev, const FW_CRect& invalidRect, ODID sequenceNumber = 0);
  106.     void                Validate(Environment* ev, const FW_CRect& validRect, ODID sequenceNumber = 0);
  107.  
  108.     // ----- Getters -----
  109.     FW_CSelection*        GetSelection(Environment* ev) const;
  110.     FW_CPart*            GetPart(Environment* ev) const;
  111.     ODTypeToken            GetPresentationType(Environment* ev) const;
  112.  
  113.     unsigned long        CountFrame(Environment* ev) const;
  114.     
  115.     void                SetDefaultEmbeddedFrameViewType(Environment *ev, ODTypeToken viewType);
  116.     ODTypeToken            GetDefaultEmbeddedFrameViewType(Environment *ev) const;
  117.  
  118.     // ------ Frame Negotiation -----
  119.     ODID                RequestSiblingFrame(Environment* ev,
  120.                                             FW_CFrame* baseFrame, 
  121.                                             ODShape* suggestedFrameShape,
  122.                                             ODTypeToken viewType,
  123.                                             FW_Boolean isOverlaid);
  124.     void                RemoveSiblingFrame(Environment* ev,
  125.                                             FW_CFrame* frameToRemove);                                
  126.     // ----- Change Presentation -----
  127.     void                ChangeAllFramesPresentation(Environment* ev, FW_CPresentation* newPresentation) const;
  128.     
  129.     // ----- View As -----
  130.     void                UpdateViewAs(Environment* ev);
  131.  
  132.     // ----- Change -----
  133.     void                ContentUpdated(Environment* ev, ODUpdateID updateID = kODUnknownUpdate);
  134.     
  135.     // ----- ReleaseAll -----
  136.     void                ReleaseAll(Environment* ev);
  137.     
  138.     // ----- Focus Set -----
  139.     ODFocusSet*            GetFocusSet(Environment* ev) const;
  140.     void                AdoptFocusSet(Environment* ev, ODFocusSet* focusSet);
  141.     
  142.     // ----- View resource -----
  143.     FW_ResourceID        GetViewResourceID(Environment* ev, FW_Boolean isRoot) const;
  144.     
  145. //----------------------------------------------------------------------------------------
  146. //    Internal Use Only
  147. //
  148. public:
  149.     FW_CViewAs*            PrivAcquireViewAs(Environment* ev, FW_CFrame* frame, ODTypeToken viewAs);    
  150.     void                PrivReleaseViewAs(FW_CViewAs* viewAs);
  151.  
  152.     void                PrivAddFrame(Environment *ev, FW_CFrame* frame);
  153.     void                PrivRemoveFrame(Environment *ev, FW_CFrame* frame);
  154.     
  155.     void                PrivDeleteDisplayFrame(Environment *ev, FW_CPrivDisplayFrame* displayFrame);
  156.     
  157.     FW_CPrivDisplayFrame*    PrivGetDisplayFrame(FW_CFrame* frame) const;
  158.     
  159.     virtual FW_CFrame*    PrivNewFrame(Environment *ev,
  160.                                     ODFrame* odFrame, 
  161.                                     FW_Boolean fromStorage);
  162.     
  163.     // ----- Frame Removed Notification -----
  164.     void                PrivFrameRemoved(Environment *ev, FW_CFrame* frame, FW_Boolean toStorage);
  165.  
  166.     // ----- A drag is pending on one of the frame of this presentation -----
  167.     FW_Boolean            PrivIsDragPending() const;
  168.     void                PrivSetDragPending(FW_Boolean pending);
  169.                                 
  170. //----------------------------------------------------------------------------------------
  171. //    Data Members
  172. //
  173. private:    
  174.     FW_CPart*                                        fPart;
  175.     FW_CSelection*                                    fSelection;
  176.     FW_TOrderedCollection<FW_CPrivDisplayFrame>*     fFrames;
  177.     ODTypeToken                                        fPresentationType;
  178.     ODFocusSet*                                        fFocusSet;
  179.     
  180.     FW_CViewAs*                                        fViewAsThumbnail;
  181.     FW_CViewAs*                                        fViewAsSmallIcon;
  182.     FW_CViewAs*                                        fViewAsLargeIcon;
  183.     
  184.     ODTypeToken                                        fDefaultEmbeddedFrameViewType;    // ViewAs of new embedded frames
  185.     FW_Boolean                                        fDragPending;                    // Use during a drag so the selecion can be flagged as in limbo
  186.     FW_ResourceID                                    fRootViewResourceID;            // 0 if views not created from resources
  187.     FW_ResourceID                                    fViewResourceID;                // 0 if views not created from resources
  188. };
  189.  
  190.  
  191. //========================================================================================
  192. // Inlines
  193. //========================================================================================
  194.  
  195. //----------------------------------------------------------------------------------------
  196. //    FW_CPresentation::GetSelection
  197. //----------------------------------------------------------------------------------------
  198. inline FW_CSelection* FW_CPresentation::GetSelection(Environment*) const
  199. {
  200.     return fSelection;
  201. }
  202.  
  203. //----------------------------------------------------------------------------------------
  204. //    FW_CPresentation::GetSelection
  205. //----------------------------------------------------------------------------------------
  206. inline FW_CPart* FW_CPresentation::GetPart(Environment*) const
  207. {
  208.     return fPart;
  209. }
  210.  
  211. //----------------------------------------------------------------------------------------
  212. //    FW_CPresentation::GetPresentationType
  213. //----------------------------------------------------------------------------------------
  214. inline ODTypeToken FW_CPresentation::GetPresentationType(Environment*) const
  215. {
  216.     return fPresentationType;
  217. }
  218.  
  219. //----------------------------------------------------------------------------------------
  220. //    FW_CPresentation::SetDefaultEmbeddedFrameViewType
  221. //----------------------------------------------------------------------------------------
  222. inline void FW_CPresentation::SetDefaultEmbeddedFrameViewType(Environment*, ODTypeToken viewType)
  223. {
  224.     fDefaultEmbeddedFrameViewType = viewType;
  225. }
  226.  
  227. //----------------------------------------------------------------------------------------
  228. //    FW_CPresentation::GetDefaultEmbeddedFrameViewType
  229. //----------------------------------------------------------------------------------------
  230. inline ODTypeToken FW_CPresentation::GetDefaultEmbeddedFrameViewType(Environment*) const
  231. {
  232.     return fDefaultEmbeddedFrameViewType;
  233. }
  234.  
  235. //----------------------------------------------------------------------------------------
  236. //    FW_CPresentation::GetFocusSet
  237. //----------------------------------------------------------------------------------------
  238. inline ODFocusSet* FW_CPresentation::GetFocusSet(Environment*) const
  239. {
  240.     return fFocusSet;
  241. }
  242.  
  243. //----------------------------------------------------------------------------------------
  244. //    FW_CPresentation::PrivIsDragPending
  245. //----------------------------------------------------------------------------------------
  246. inline FW_Boolean FW_CPresentation::PrivIsDragPending() const
  247. {
  248.     return fDragPending;
  249. }
  250.  
  251. //----------------------------------------------------------------------------------------
  252. //    FW_CPresentation::PrivSetDragPending
  253. //----------------------------------------------------------------------------------------
  254. inline void FW_CPresentation::PrivSetDragPending(FW_Boolean pending)
  255. {
  256.     fDragPending = pending;
  257. }
  258.  
  259. //----------------------------------------------------------------------------------------
  260. //    FW_CPresentation::GetViewResourceID
  261. //----------------------------------------------------------------------------------------
  262. inline FW_ResourceID FW_CPresentation::GetViewResourceID(Environment*, FW_Boolean isRoot) const
  263. {
  264.     return isRoot ? fRootViewResourceID : fViewResourceID;
  265. }
  266.  
  267. #endif